home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3913 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.1 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: iiasa.ac.at!marek
  3. From: marek@iiasa.ac.at (Marek  MAKOWSKI)
  4. Subject: nested va_list
  5. Message-ID: <1996Jan26.180430.22340@iiasa.ac.at>
  6. Organization: IIASA, Laxenburg, Austria
  7. X-Newsreader: TIN [version 1.2 PL2]
  8. Date: Fri, 26 Jan 1996 18:04:30 GMT
  9.  
  10. This might be an easy problem:
  11. I want to call from a function with variable number of parameters
  12. another function and pass the parameters without processing.
  13. I would appreciate comments, if there exists a robust and
  14. portable way to do it.
  15. For example:
  16.  
  17. #include <stdarg.h>
  18.  
  19. void X::g(const char *fmt, ...) {
  20.     va_list lstp;
  21.     va_start(lstp, format);
  22.     // s is space allocated in X
  23.     (void) vsprintf(s, format, lstp);
  24.     va_end(lstp);
  25.     //
  26. }
  27.  
  28. void X::f(const char *fmt, ...) {
  29.     // I want to avoid processing the arguments here before calling g();
  30.     g( ????? );
  31. }
  32.  
  33. Thanks in advance,
  34. Marek
  35. -- 
  36.                   Marek Makowski  | Email: marek@iiasa.ac.at
  37.          International Institute  | Phone: (+43-2236) 807.561
  38.     for Applied Systems Analysis  | Fax:   (+43-2236) 71.313
  39.        A-2361 Laxenburg, Austria  | Web: http://www.iiasa.ac.at
  40.